package org.alps.pattern.observer.circle;

import java.util.Observable;
import java.util.Observer;

/**
 * 观察者
 * @date 2021-05-01
 * @author zkw
 */
public class Teacher implements Observer {
    private String name;

    public Teacher(String name) {
        this.name = name;
    }

    @Override
    public void update(Observable o, Object arg) {
        GpCircle gp = (GpCircle) o;
        Question question = (Question) arg;
        System.out.println("===============");
        System.out.println(
                name + "老师，您好！\n" +
                        "您收到了一个来自’" + gp.getName() + "‘的提问，希望您能解答，问题内容如下：\n" +
                        question.getContent() + "\n" +
                        "提问者：" + question.getUserName()
        );
    }
}
